<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>资讯详情</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin() {
            api.closeWin({});
        };
    </script>
</head>
<style>
    html,
    body {
        height: 100%;
        background: rgba(0, 0, 0, 0);
    }
</style>

<body>
    <header class="aui-bar aui-bar-nav pos" id='topbar'>
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title" id="title_head">修改新密码</div>
    </header>

</body>

<script type="text/javascript">
    apiready = function() {


        lock();

    };

    function lock() {

        var password = $api.getStorage('password');
        // alert(password);


        var patternLock = api.require('patternLock');
        patternLock.addPatternLock({
            viewName: 'main',
            rightColor: '#ffffff',
            drawColor: '#ffffff',
            wrongColor: '#ffffff',
            normalColor: '#ffffff',
            frame: "{{0,150},{" + api.winWidth + "," + api.winHeight + "}}",
            mode: '1',
            rightCode: password
        }, function(ret, err) {
            if (ret) {
                if (ret.status == "2") {
                  api.toast({
                      msg: '请重复输入密码！',
                      duration: 2000,
                      location: 'middle'
                  });
                }
                if (ret.status == "3") {
                  api.toast({
                      msg: '重复输入不一致！',
                      duration: 2000,
                      location: 'middle'
                  });
                }
                if (ret.status == "4") {
                    api.toast({
                        msg: '设置密码成功',
                        duration: 2000,
                        location: 'bottom'
                    });
                    $api.setStorage('password', ret.code);
                    api.closeWin();
                }
            } else {
              api.toast({
                  msg: '设置失败！',
                  duration: 2000,
                  location: 'middle'
              });
            }
        });

    }
</script>

</html>
